package com.nanyang.tms.api.dto.request.forecast;

import java.math.BigDecimal;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nanyang.common.core.domain.ApiRequest;

import lombok.Data;
@Data
public class ForecastInfoAddRequest extends ApiRequest{
   
	private static final long serialVersionUID = 1L;
	@NotEmpty(message = "目的国家不能为空")
	@Length(max = 3, message = "countyCode长度需小于3个字符")
	private String countyCode;  //国家编号
	@NotNull(message = "重量不能位空")
	@Digits(integer = 18, fraction=2, message = "客户重量整数部分最多18位小数部分最多2位")
	@DecimalMin(value = "0.01", message = "客户重量必须大于0")
	private BigDecimal weight;  //重量
	@NotEmpty(message = "销售产品编码不能为空")
	@Length(max = 32, message = "销售产品编码长度需小于32个字符")
	private String saleProductCode; //产品编码
	@NotEmpty(message = "客户单号不能为空")
	@Length(max = 50, message = "客户单号长度需小于50个字符")
	private String customerNo;  //客户订单号
	@NotEmpty(message = "货物类型编码不能为空")
	@Length(max = 20, message = "货物类型编码长度需小于20个字符")
	private String cargoTypeCode; //货物类型  ：袋子 文件 包裹
	@NotEmpty(message = "货物类型名称不能为空")
	@Length(max = 30, message = "货物类型名称需小于30个字符")
	private String cargoTypeName; //货物类型  ：袋子 文件 包裹
	@Length(max = 200, message = "备注长度需小于200个字符")
	private String remark; //备注
	
	@NotNull(message = "件数不能为空")
	@Min(value=1,message = "件数必须大于0")
	private Integer num;
	@Valid
    @NotNull(message = "发货人信息不能为空")
	private ForecastSenderAddRequest sender;
	@Valid
	@NotNull(message = "收货人信息不能为空")
	private ForecastReceiverAddRequest receiver;
	@Valid
	@NotNull(message = "材积信息不能为空")
	@Size(min = 1, message = "至少要有一个材积信息")
	private List<ForecastVolumeAddReuqest> volumes;
	@Valid
	@NotNull(message = "报关信息不能为空")
	@Size(min = 1, message = "至少要有一个报关信息")
	private List<ForecastDeclareAddReuqest> declares;
	
	@JsonIgnore
	private String companyCode;
	@JsonIgnore
	private String pin;
	@JsonIgnore
	private String ip;
	@Override
	public void requestCheck() {
		// TODO Auto-generated method stub
		
	}

}
